<?php if ( !defined('BASEPATH')) exit('No direct script access allowed');

class Read_attempts extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->load->model('wus');
		$this->load->model($this->session->userdata('formodel'));
		$this->load->library('variable');

	}


	public function index(){
	  	$this->load->view('layouts/header',$this->variable->load_data($this->session->userdata('title')));
	  	$this->load->view($this->session->userdata('formain'),array(
	  		'zones'		=>	$this->read_attempts_model->getzoning(),
	  		'meter_reader'	=> $this->read_attempts_model->getusers()
	  	));
	  	$this->load->view('layouts/footer');
	 }

	public function search(){
 		$query = $this->read_attempts_model->search($this->input->post('zone'),$this->input->post('meter_reader'),$this->input->post('mr_from'),$this->input->post('mr_to'));
 		echo json_encode($query);
	 }
}
